/*
 * Copyright (C) 2015 yixun All Rights Reserved.
 * 
 * BuildingTypeEnum.java
 */
package com.qiaofang.entity.enums;


import com.qiaofang.common.utils.EnumUtil;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

/**
 * [文件名称]<br>
 * PremisesDynamic.java<br>
 * <br>
 * [文件描述]<br>
 * 楼盘动态 pojo bean<br>
 * <br>
 * [修改记录]<br>
 * 2015-10-14 15:34:13 创建 陶俊代码生成器<br>
 * 
 * @author 陶俊代码生成器
 * @version 1.00
*/
public enum AbroadBuildingTypeEnum implements Serializable{
		/**
		 *国内
		*/
		type_0("0","多层",null),
		type_1("1","高层",null),
		

	/**
	 * V10 打通渠道新增
	 */
	type_2("2","小高层",null),
	type_3("3","多层复式",null),
	type_4("4","高层复式",null),
	type_5("5","多层跃式",null),
	type_6("6","高层跃式",null),
	type_7("7","独立别墅",null),
	type_8("8","联体别墅",null),
	type_9("9","双拼别墅",null),
	type_10("10","裙楼",null),
	type_11("11","四合院",null),
	type_12("12","平层",null),
	type_13("13","洋房",null),

	/**
		 * 国外
		*/
		type_50("50","独立",null),
		type_51("51","连体",null),
		type_52("52","双拼",null),
		type_53("53","公寓",null),
		type_54("54","低层",null),
		type_55("55","中高层",null),
		type_56("56","超高层",null)
		;

		private final String no;
		private final String des;
		private final Enum parent;

		static{
			EnumUtil.ENUMS_TO_VIEW.put("building_type", AbroadBuildingTypeEnum.values());
		}

		/**
		 * 私有构造函数
		 * @param no
		 * @param des
		 */
		AbroadBuildingTypeEnum(String no, String des, Enum parent) {
			this.no = no;
			this.des = des;
			this.parent = parent;
		}

		/**
		 * @return Returns the no.
		 */
		public String getNo() {
			return no;
		}

		/**
		 * @return Returns the des.
		 */
		public String getDes() {
			return des;
		}
		
		/**
		 * @return Returns the parent.
		 */
		public Enum getParent() {
			return parent;
		}

		/**
		 * 通过枚举<code>des</code>获得枚举
		 * 
		 * @param des
		 * @return
		 */
		public static AbroadBuildingTypeEnum getByDescription(String des) {
			if(StringUtils.isBlank(des)){
				return null;
			}
			for (AbroadBuildingTypeEnum menum : values()) {
				if (menum.getDes().equals(des)) {
					return menum;
				}
			}
			return null;
		}
		public static AbroadBuildingTypeEnum getByNo(String no) {
			if(StringUtils.isBlank(no)){
				return null;
			}
			for (AbroadBuildingTypeEnum menum : values()) {
				if (menum.getNo().equals(no)) {
					return menum;
				}
			}
			return null;
		}
}
